<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <meta content="telephone=no" name="format-detection" />
    <title>友吃送“福梨”活动</title>
    <link rel="stylesheet" href="<{$smarty.const.__STATIC__}>css/layout.css" />
    <link rel="stylesheet" href="<{$smarty.const.__STATIC__}>css/style.css" />
</head>
<body style="background: #ebebeb;  padding-bottom: 1rem;">
<div id="adv-header">
    <div class="header-inner">
        <div class="tit"><img src="<{$smarty.const.__STATIC__}>images/tit2.png" /></div>
        <div class="ren"><img src="<{$smarty.const.__STATIC__}>images/ren.png" /></div>
        <img class="bac" src="<{$smarty.const.__STATIC__}>images/xqbac.jpg"/>
    </div>
</div>
    <div id="adv-btns">
        <div class="name">
            <span class="name-png">
                <img src="<{$smarty.const.__STATIC__}>images/name.png" />
            </span>
        </div>
        <div class="btn bacnone" id="like-count-view">
            <a href="javascript:void(0)">已获得【<{$like_count}>】位好友帮忙</a>
        </div>
        <div class="btn">
            <a class="lp" href="javascript:void(0)">发动好友帮忙拉票</a>
        </div>

    </div>
    <div id="rank-bar">
        <h3>实时投票排行榜</h3>
        <ul class="rank-list">
            <{foreach from=$userList key=num item=user}>
            <li><span class="l">第 <{$i=$i+1}><{$i}> 名</span><span class="c"><{$user->name}></span><span class="r"><{$user->like_count}>票</span></li>
            <{/foreach}>
        </ul>
    </div>
    <div id="rule">
        <h2 class="rule-tit"><span>活动规则<em class="arrr arr"><img src="<{$smarty.const.__STATIC__}>images/arr.png"/></em><em class="arr arrl"><img src="<{$smarty.const.__STATIC__}>images/arr.png"/></em></span></h2>
        <dl class="mianf">
            <dt><span>免费福梨1：</span></dt>
            <dd>收集满20个好友投票的，可免费获得友吃送出的连州水晶梨礼盒一份，限量400份。</dd>
        </dl>
        <dl class="mianf">
            <dt><span>免费福梨2：</sxpan></dt>
            <dd>8月09日上午12点投票截止，票数最高的前10名吃货达人可赢得<a href="zen.html">（曾屋料理）</a>送出的250元/位下午茶聚会（因个人原因无法参加的，友吃不承担其损失）；与友吃小编一起玩游戏，品下午茶。</dd>
        </dl>
        <dl class="mianf">
            <dt><span>注意事项：</span></dt>
            <dd>获得奖品，请下载【友吃】APP，填写个人收货信息；</dd>
            <dd>8月09日下午会有专人客服电话联系确认收货地址和免费下午茶聚会的参加时间；</dd>
            <dd>【友吃】微信公众号也会同时公布美食下午茶的10位吃货达人的免费名单和活动时间，敬请留意；</dd>
            <dd>快递会在8月10日后统一发货，若在发货5日内未收到水晶梨，或对活动内容有疑问，请与【友吃】公众号客服联系，或致电020-81245266查询</dd>
            <dd>如发现恶意刷票行为立即取消参与资格，活动最终解释权，归【友吃】App官方所有！</dd>
        </dl>
    </div>
    <div id="all-page" style="display: <{if $is_reg eq 1}>
        none
    <{else}>
        block
    <{/if}>;"></div>
    <div class="bot-hint">
        <span class="hint-png"><img src="<{$smarty.const.__STATIC__}>images/arrow_w.png" /></span>
    </div>
    <div id="reg-div" class="fixed-box" style="display: <{if $is_reg eq 1}>
        none
    <{else}>
        block
    <{/if}>;">
        <div class="fixed-cont">
            <h2 class="cyut">请输入您的昵称和手机号获取<br/>免费抢“连州水晶梨”资格</h2>
			<form action="<{$smarty.const.DOMAIN}>register.php" method="post" id="regForm">
                <input type="hidden" name="openid" value="<{$openid}>" />
                <input type="hidden" name="submit" value="submit" />
                <!--
                <input type="hidden" name="appId" value="<{$appId}>" />
                <input type="hidden" name="timestamp" value="<{$timestamp}>" />
                <input type="hidden" name="nonceStr" value="<{$nonceStr}>" />
                <input type="hidden" name="signature" value="<{$signature}>" />
                -->
                <dl class="texts">
                    <dd class="text"><input id="nick-name" type="text" name="name" value="" maxlength="5" placeholder="姓名" /></dd>
                    <dd class="text"><input type="text" name="phone" value="" placeholder="手机号码" /></dd>
                    <!--<dd class="text"><input class="d" type="text" value="" placeholder="免费参与码" />
                        <span class="hq">获取验证码</span>
                        -->
                    </dd>
                    <input type="submit" class="btn" value="确定提交" />
                    <dd class="hint">注意:请填写正确的手机号码以方便工作人员在您获奖之后与您取得联系！</dd>
                </dl>
            </form>
        </div>
    </div>
    <div class="fixed-box" style="display: none;">
        <div class="fixed-cont">
            <div class="xinxi">
                <div class="que-bar">
                    <span class="que"><img src="<{$smarty.const.__STATIC__}>images/que.png"></span>
                </div>
                <div class="que-txt"> 只能为好友抢一次福利哦！</div>
                <div class="que-btn">确定</div>
            </div>
        </div>
    </div>
    <div id="xinxi" class="fixed-box" style="display: none;">
        <div class="fixed-cont">
            <div class="xinxi">
                <div class="que-bar">
                    <span class="que"><img src="<{$smarty.const.__STATIC__}>images/que.png"></span>
                </div>
                <div class="que-txt"> 只能为好友抢一次福利哦！</div>
                <div class="que-btn">确定</div>
            </div>
        </div>
    </div>
    <div id="confirm-div" data-loca="1"  class="fixed-box" style="display: none;">
        <div class="fixed-cont">
            <div class="xinxi">
                <div class="que-bar">
                    <span class="que"><img src="<{$smarty.const.__STATIC__}>images/que.png"></span>
                </div>
                <div class="que-txt2">
                   <span>
                        您已成功参与活动，赶快发送给好友、分
                    享到朋友圈及微信群，让大家投票【帮<strong class="nick_name"><{$name}></strong>抢福利】
                   </span>
                </div>
                <div class="que-btn">确定</div>
            </div>
        </div>
    </div>
    <div class="share-hint" style="display: none;">
        <div class="zhe"><img src="<{$smarty.const.__STATIC__}>images/zhe.png"></div>
        点击右上角菜单，赶快发送给好友、分享
        到朋友圈及微信群，让大家投票【帮<strong class="nick_name"><{$name}></strong>
        抢福梨】
    </div>
    <script src="<{$smarty.const.__STATIC__}>js/zepto.min.js" type="text/javascript"></script>
    <script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js" type="text/javascript"></script>
    <script src="<{$smarty.const.__STATIC__}>js/public.js" type="text/javascript"></script>
    <script>
        $(function(){
            // 表单注册
            $('#regForm').submit(function(){
                var url = $(this).attr('action');
                $.ajax({
                    type: "post",
                    url: url,
                    dataType: "text",
                    data: $(this).serialize(),
                    success: function(text){
                        var msg = text.split('_');
                        if(text.indexOf('ok') != -1){
                            $('#reg-div').hide();
                            $('.nick_name').text(msg[msg.length-1]);
                            $('#confirm-div').css('display','block');
                            $('#like-count-view').css('display','none');
                        }else{
                            $("#xinxi").css("display","block").find(".que-txt").text(msg[1]);
                        }

                    },
                    error : function (json) {
                        alert("error"+ JSON.stringify(json));
                    }
                });
                return false;
            });
        });

        // 微信js验证
        wx.config({
            debug: false,
            appId: '<{$appId}>',
            timestamp: '<{$timestamp}>',
            nonceStr: '<{$nonceStr}>',
            signature: '<{$signature}>',
            jsApiList: [// 所有要调用的 API 都要加到这个列表中
                        'checkJsApi',
                        'onMenuShareTimeline',
                        'onMenuShareAppMessage']
        });
        wx.error(function(res){

            alert(JSON.stringify(res));

        });

        // 在这个方法里面执行接口调用
        wx.ready(function(){
            var title='友吃送“福梨”活动',
                    desc = '我是【<{$name}>】，快来帮我抢连州水晶梨吧！',
                    imgUrl = 'http://wx.youchi365.com/static/images/tit2.png',
                    link = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=<{$smarty.const.APPID}>&redirect_uri=<{$smarty.const.DOMAIN}>ac_index.php&response_type=code&scope=snsapi_base&state=<{$openid}>#wechat_redirect';
            //var nickName = $.empty($('#nick-name').val()) ? :$('#nick-name').val();
            // 调用微信js，分享给朋友
            wx.onMenuShareAppMessage({
                title: title,
                desc: desc,
                link: link,
                imgUrl: imgUrl,
                success: function (res) {
                    alert('分享好友成功');
                },
                cancel: function (res) {
                    alert('已取消');
                },
                fail: function (res) {
                    alert(JSON.stringify(res));
                }
            });
            // 调用微信js,分享到朋友圈
            wx.onMenuShareTimeline({
                title: title, // 分享标题
                link: link, // 分享链接
                imgUrl: imgUrl, // 分享图标
                success: function () {
                    // 用户确认分享后执行的回调函数
                    alert('分享朋友圈成功');
                },
                cancel: function () {
                    // 用户取消分享后执行的回调函数
                    alert('已取消');
                }
            });
        });

        /*
        wx.checkJsApi({
            jsApiList: [
                'onMenuShareTimeline',
                'onMenuShareAppMessage'
            ],
            success: function (res) {
                //alert(JSON.stringify(res));
            }
        });
        */


    </script>
</body>
</html>